﻿using System;
using System.Collections.Generic;
using Acr.UserDialogs;
using Cashbook.ViewModels;
using Xamarin.Forms;

namespace Cashbook.Views
{
    public partial class BillIsPayedPage : ContentPage
    {
        public BillsIsPayedM billsListVM;
        public BillIsPayedPage()
        {
            InitializeComponent();
            billsListVM = new BillsIsPayedM(true, this.Navigation, UserDialogs.Instance);

            this.BindingContext = billsListVM;

        }
		protected override void OnAppearing()
		{
		    base.OnAppearing();

            if (billsListVM.Bills.Count == 0)
		        billsListVM.LoadBillsCommand.Execute(null);
		}

        void Handle_ItemTapped(object sender, Xamarin.Forms.ItemTappedEventArgs e)
        {
            var dataItem = e.Item as BillVM;
            Navigation.PushAsync(new BillDetailPage(dataItem));
			
		}
    }
}
